package com.study.mybatis;

import com.study.mybatis.dao.UserMapper;
import com.study.mybatis.dao.entity.User;
import com.study.mybatis.session.SqlSession;
import com.study.mybatis.session.SqlSessionFactory;
import com.study.mybatis.session.SqlSessionFactoryBuilder;

/**
 * @author yuantongqin
 * 2021/7/31
 **/
public class MybatisApp {


    public static void main(String[] args) {

        //

        SqlSessionFactory sqlSessionFactory = SqlSessionFactoryBuilder.builder("db.properties");

        SqlSession sqlSession = sqlSessionFactory.openSession();
        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
        User userById = mapper.getUserById(1);
        System.out.println(userById.toString());

    }
}
